﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DPS.Prototype.Extension;

namespace DPS.Prototype.Model
{
    [Inspect]
    public class WorkOrder:IComparable<WorkOrder>,IEquatable<WorkOrder>
    {
        [Inspect(OrderNo=0)]
        public string PlantCode { get; set; }
        [Inspect(OrderNo = 1)]
        public string OrderNo { get; set; }
        [Inspect(OrderNo = 2)]
        public string Model { get; set; }
        [Inspect(OrderNo = 3)]
        public DateTime GIDate { get; set; }
        [Inspect(OrderNo = 4)]
        public DateTime BuildDate { get; set; }
        [Inspect(OrderNo = 4)]
        public string AssignedProducLineNo 
        {
            get 
            {
                if (this.AssignedProducLine != null)
                {
                    return this.AssignedProducLine.LineNo;
                }
                else
                {
                    return "";
                }
            }
        }

        [Inspect(OrderNo =5)]
        public float OrderQty { get; set; }
        [Inspect(OrderNo =6)]
        public float OpenOrderQty { get; set; }
        [Inspect(OrderNo =7)]
        public float FilishedQty { get; set; }
        public DateTime CreateDate { get; set; }

        public Sku Sku { get; set; }

        
        public SalesOrder SalesOrder { get; set; }

        public ProdLine AssignedProducLine { get; set; }

        public Region Region { get; set; }
        public SubRegionCode SubRegionCode { get; set; }

        public WorkOrderStatus WorkOrderStatus { get; set; }

      
        public int CompareTo(WorkOrder otherOrder)
        {
            return string.Compare(this.OrderNo, otherOrder.OrderNo);
        }

        public bool Equals(WorkOrder otherOrder)
        {
            return CompareTo(otherOrder)==0;
        }
    }
}
